package com.example.data;



import com.example.utils.FileRead;
import com.example.utils.JSON;

import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;

public class ImportDataFromFoodGame{

    private final static String data1 = "/foodgameData.json";
    private final static String data2 = "/我拥有的厨师和菜谱.json";
    private final static String data3 = "/我拥有的厨具.json";


    public static ObjectNode officalData(String filepath) {
        ObjectNode jsonObject = null;
        try {
            jsonObject=JSON.getObjectMapper().readValue(new File(filepath), ObjectNode.class);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return jsonObject;
    }

    public static ObjectNode officalData() {
        return officalData(data1);
    }

    public static ObjectNode IndividualData(String data1,String data2) {
        ObjectNode jsonObject = officalData(data1);
        try {
            ArrayNode  array = JSON.getObjectMapper().readValue(new File(data2), ArrayNode.class);
            jsonObject.put("equips", array);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return jsonObject;
    }



}
